<?php
// **************************************************************
// | Name: 星空框架 财务流水
// **************************************************************
// | Version: V5.0
// **************************************************************
// | Author: xkyinzhe <zhonghuaxinxing@sina.cn>
// **************************************************************
// | Time: 2021-08-17 14:21
// **************************************************************
declare(strict_types=1);

namespace app\common\model;

use think\facade\Session;
use think\model\concern\SoftDelete;

/**
 * @xk 财务流水
 */
class Finance extends BaseModel
{
    use SoftDelete;
    protected $name = 'finance';
    protected $pk = 'finance_id';
    protected $deleteTime = 'delete_time';
    /**
     * @xk 写入前操作
     *
     * @method onBeforeWrite
     * @param  [type]                  $data                     [description]
     * @return [type]                                            [description]
     * @Author xkyinzhe                <zhonghuaxinxing@sina.cn>
     * @Time   2021-05-11T13:52:53+080
     */
    public static function onBeforeWrite($data)
    {
        // unset($data['act']);
        unset($data['controllers']);
        unset($data['actions']);
        if (!$data->create_time) {
            $data->update_time = $data->create_time = date('Y-m-d H:i:s');
        }
    }
}
